#!/usr/bin/perl -w

if (@ARGV != 1) {
    usage();
    exit;
}

my $bits = $ARGV[0];
my $ins  = $bits * 2;
my $outs = $bits + 1;

print "$ins $outs\n";
for(my $i = 0; $i < 2 ** $ins; $i++) {
    my $a = $i & ((1 << $bits) - 1);
    my $b = $i >> $bits;
    my $ans = $a + $b;
    for(my $j = $outs - 1; $j >= 0; $j--) {
	print (($ans >> $j) & 0x1);
    }
    print "\n";
}

sub usage {
    print "usage:\n";
    print "\t./gen_adder_truth.pl num_inputs\n";
}
